﻿using System.Collections.Generic;

using OnlineFamilyCalendar.UI.Presentation.Views;
using OnlineFamilyCalendar.Service;

namespace OnlineFamilyCalendar.UI.Presentation
{
    public class RegisterPresenter
    {
        private IRegisterView _view;
        private IFamilyMemberService _familyMemberService;

        public RegisterPresenter(IRegisterView view)
        {
            _view = view;
        }

        public void Register()
        {
            // ToDo Verify both password are equal
            // ToDo Validate Email Address

            _familyMemberService = new FamilyMemberService();
            _view.RegisterUrl = _familyMemberService.RegisterNewFamilyMember(_view.Loginname, _view.Password, _view.EmailAddress);
            _view.RegisterText = "Confirm the Registration";            
        }

        public void ActivateUser(string cypherFamilyMemberIdentifier)
        {
            _familyMemberService = new FamilyMemberService();
            _familyMemberService.ActivateFamilyMember(cypherFamilyMemberIdentifier);
        }
    }
}
